<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>组件</title>
    <script src="./js/react.development.js"></script>
    <script src="./js/react-dom.development.js"></script>
    <script src="./js/babel.min.js"></script>
    <style>
      .header {
        height: 100px;
        background: #aef;
      }
      .main {
        height: 400px;
        background: rgb(162, 140, 184);
      }
      .footer {
        height: 100px;
        background: rgb(212, 161, 126);
      }
    </style>
  </head>
  <body>
    <div id="root"></div>
    <script type="text/babel">
      //创建一个虚拟 DOM 对象
      // let vdom = <div>
      //     <div className="header"></div>
      //     <div className="main"></div>
      //     <div className="footer"></div>
      //   </div>

        class Header extends React.Component{
          render(){
            return <div className="header"></div>
          }
        }

        class Main extends React.Component{
          render(){
            return <div className="main"></div>
          }
        }
        class Footer extends React.Component{
          render(){
            return <div className="footer"></div>
          }
        }

        class App extends React.Component{
          render(){
            return <div>
              <Header></Header>
              <Main></Main>
              <Footer></Footer>
              </div>
          }
        }
        

      //渲染
      ReactDOM.render(<App/>, document.querySelector('#root'));
    </script>
  </body>
</html>
